<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="${BASE_PATH}/static/app/css/base.css"/>
		<link rel="stylesheet" type="text/css" href="${BASE_PATH}/static/app/css/header.css"/>
		<link rel="stylesheet" type="text/css" href="${BASE_PATH}/static/app/css/evaluate.css"/>
		<title></title>
	</head>
	<body>
		<div class="content">
			<div class="header">
				<span class="back" onclick="javascript:history.go(-1);"></span>
				<span class="header_text">评价</span>
			</div>
			<input type="text" hidden="hidden" id="orderNumber" value="${order.orderNum }">
			<div class="container">
				<div class="star">
					<div class="start">
						<span>商品满意度</span>
						<ul>
							<li data-value="1"></li>
							<li data-value="2"></li>
							<li data-value="3"></li>
							<li data-value="4"></li>
							<li data-value="5"></li>
						</ul>
					</div>
					<div class="starb">
						<span>服务质量满意度</span>
						<ul>
							<li data-value="1"></li>
							<li data-value="2"></li>
							<li data-value="3"></li>
							<li data-value="4"></li>
							<li data-value="5"></li>
						</ul>
					</div>
				</div>
				<div class="inp">
					<textarea id="evaltext" class="input_box" maxlength="500" placeholder=" 您的评价对我们很重要，请输入您对本次购物的评价,长度为1-500字~"></textarea>
				<%--<span class="inp_pic">
						<img class="pic" src="${BASE_PATH}/static/app/img/camera.png"/>
					</span> --%>
				</div>
				
			</div>
			<div class="bot_box">
				<span class="bot_btn" onclick="javascript:doSubmit()">提交评价</span>
			</div>
		</div>
		<script src="${BASE_PATH}/static/app/js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(".star ul").on("click","li",function(){
				$(this).toggleClass("choose"); 
				$(this).prevAll().addClass("choose");
				$(this).nextAll().removeClass("choose");
			})
			function doSubmit(){
				var eval1 = $(".start ul .choose").last().attr("data-value");
				var eval2 = $(".starb ul .choose").last().attr("data-value");
				var content = $("#evaltext").val();
				var orderNum = $("#orderNumber").val();
				Kit.ajax.post("${BASE_PATH}/order/doEval",{orderNum:orderNum,eval1:eval1,eval2:eval2,content:content},function(result){
					if(result.flag == -1){
						Kit.ui.alert(result.message);
					}else if(result.flag == 0){
						Kit.ui.alert("已评价，欢迎您再次光临~",function(){
							Kit.render.redirect("${BASE_PATH}/order/list?state=4");
						});
					}
				});
				
			}
		</script>
	</body>
	<script type="text/javascript" src="${BASE_PATH}/static/app/js/kit.js"></script>
	<script type="text/javascript" src="${BASE_PATH}/static/lib/layer/layer.js"></script>
</html>
